/**
 * 用户身份的路由
 */
import {request} from './request'
import {formatDate} from "../common/utils";

/**
 * 完善用户信息
 * @param user
 * @returns {返回instance方法|发送网络请求}
 */
export const prefectUserInfo = (user) => {

  // 修改用户的生日日期格式
  user.birthday = formatDate(user.birthday, "yyyy-MM-dd hh:mm:ss");

  return request({
    url: '/user/perfect',
    method: 'post',
    data: {
      user
    }
  })
}

/**
 * 添加订单
 * @param order
 * @returns {返回instance方法|发送网络请求}
 */
export const addOrder = (order) => {
  return request({
    url: '/user/add-order',
    method: 'post',
    data: {
      order
    }
  })
}

/**
 * 添加订单明细
 * @param order_list
 * @returns {返回instance方法|发送网络请求}
 */
export const addOrderList = (order_list) => {
  return request({
    url: '/user/add-order_list',
    method: 'post',
    data: {
      order_list
    }
  })
}